home *** CD-ROM | disk | FTP | other *** search
- unit Daytype;
-
- interface
-
- uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
- Buttons, ExtCtrls;
-
- type
- TDayTypeDlg = class(TForm)
- OKBtn: TButton;
- CancelBtn: TButton;
- Bevel1: TBevel;
- EditName: TEdit;
- EditFirstShow: TEdit;
- EditLastShow: TEdit;
- EditShowFreq: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- CheckBoxCh: TCheckBox;
- CheckBoxHo: TCheckBox;
- CheckBoxFl: TCheckBox;
- EditMonth: TEdit;
- LabelMonth: TLabel;
- EditMonthday: TEdit;
- RadioGroup1: TRadioGroup;
- LabelMonthday: TLabel;
- ComboBoxRelType: TComboBox;
- procedure OKBtnClick(Sender: TObject);
- procedure RadioGroup1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- DayTypeDlg: TDayTypeDlg;
-
- implementation
- uses Main ,Kronos;
-
- {$R *.DFM}
-
- procedure TDayTypeDlg.OKBtnClick(Sender: TObject);
- begin
- with Form1.UserDay do
- begin
- AName := EditName.Text;
- if RadioGroup1.ItemIndex = 0 then
- begin
- ADate :=
- StrToInt(EditMonth.Text)*100+StrToInt(EditMonthday.Text);
- AnOffset := 0;
- ARelDayType := 0;
- end
- else
- begin
- ADate := 0;
- AnOffset := StrToInt(EditMonth.Text);
- AReldayType := ComboBoxReltype.ItemIndex + 1;
- end;
- AFirstShowUp := StrToInt(EditFirstShow.Text);
- ALastShowUp := StrToInt(EditLastShow.Text);
- AShowUpFrequency := StrToInt(EditShowFreq.Text);
- AChurchDay := CheckBoxCh.Checked;
- AHoliday := CheckBoxHo.Checked;
- AFlagDay := CheckBoxFl.Checked;
- AUserCalc := false;
- end;
- end;
-
- procedure TDayTypeDlg.RadioGroup1Click(Sender: TObject);
- begin
- with ComboBoxReltype do
- begin
- if RadioGroup1.ItemIndex = 0 then
- begin
- Visible := false;
- Left := EditMonthDay.Left + EditMonthDay.Width + 10;
- EditMonthDay.Visible := true;
- LabelMonthday.Caption := 'Monthday';
- LabelMonth.Caption := 'Month';
- end
- else
- begin
- if ItemIndex = -1 then
- ItemIndex := 0;
- Left := EditMonthDay.Left;
- Visible := true;
- EditMonthDay.Visible := false;
- LabelMonthday.Caption := 'Relative to';
- LabelMonth.Caption := 'Offset';
- end;
- end;
-
- end;
- procedure TDayTypeDlg.FormCreate(Sender: TObject);
- var
- I : integer;
- S : string;
- begin
- with Form1 do
- begin
- if ListBoxYe.ItemIndex = -1 then
- begin
- EditName.Text := 'New daytype';
- S := IntToStr(Kronos1.Month);
- Self.EditMonth.Text := S;
- S := IntToStr(Kronos1.Monthday);
- Self.EditMonthday.Text := S;
- EditFirstShow.Text := IntToStr(Kronos1.Year);
- EditLastShow.Text := IntToStr(Kronos1.Year);
- EditShowFreq.Text := '1';
- end
- else
- begin
- with Userday do
- begin
- EditName.Text := AName;
- EditFirstShow.Text :=
- IntToStr(AFirstShowUp);
- EditLastShow.Text :=
- IntToStr(ALastShowup);
- EditShowFreq.Text :=
- IntToStr(AShowupFrequency);
- if Date = 0 then
- begin
- ComboBoxRelType.ItemIndex := AReldayType - 1;
- Self.EditMonth.Text := IntToStr(AnOffset);
- RadioGroup1.ItemIndex := 1;
- end
- else
- begin
- Self.EditMonth.Text := IntToStr(ADate div 100);
- Self.EditMonthday.Text := IntToStr(ADate mod 100);
- RadioGroup1.ItemIndex := 0;
- end;
- CheckBoxHo.Checked := AHoliday;
- CheckBoxCh.Checked := AChurchday;
- CheckBoxFl.Checked := AFlagday;
- end;
- end;
- end;
- end;
-
- end.
-